package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.feign.order.OrderFeignClient;
import com.atguigu.gmall.model.order.vo.OrderConfirmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class OrderController {

    @Autowired
    OrderFeignClient orderFeignClient;

    @GetMapping("/trade.html")
    public String trade(Model model) {
        OrderConfirmVo orderConfirmVo = orderFeignClient.getOrderConfirmVo().getData();
        model.addAttribute("detailArrayList", orderConfirmVo.getDetailArrayList());
        model.addAttribute("totalNum", orderConfirmVo.getTotalNum());
        model.addAttribute("totalAmount", orderConfirmVo.getTotalAmount());
        model.addAttribute("userAddressList", orderConfirmVo.getUserAddressList());
        model.addAttribute("tradeNo", orderConfirmVo.getTradeNo());
        return "order/trade";
    }





}
